/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.product.manage.repository.mapper;

import info.peigen.hotpot.business.product.core.repository.entity.ProductBrandEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlManageMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(ProductBrandManageMapper)</b>
 * 管理后台 "商品品牌" 数据库映射服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024-05-02
 */
@SuppressWarnings("unused")
public interface ProductBrandManageMapper extends AbstractBeetlSqlManageMapper<ProductBrandEntity> {

    // 唯一索引[brand_id]
    @Sql("select * from product_brand where brand_id = ?")
    @Select
    ProductBrandEntity findByBrandId(String brandId);

    @Sql("select * from product_brand where brand_id = ? for update")
    @Select
    ProductBrandEntity lockByBrandId(String brandId);

    @Sql("delete from product_brand where brand_id = ?")
    @Update
    void deleteByBrandId(String brandId);

    // 索引[name]
    @Sql("select * from product_brand where name = ?")
    @Select
    ProductBrandEntity findByName(String name);

    @Sql("delete from product_brand where name = ?")
    @Update
    void deleteByName(String name);

    // 索引[self]
    @Sql("select * from product_brand where self = ?")
    @Select
    ProductBrandEntity findBySelf(String self);

    @Sql("delete from product_brand where self = ?")
    @Update
    void deleteBySelf(String self);

    // 索引[partner_id]
    @Sql("select * from product_brand where partner_id = ?")
    @Select
    ProductBrandEntity findByPartnerId(String partnerId);

    @Sql("delete from product_brand where partner_id = ?")
    @Update
    void deleteByPartnerId(String partnerId);
}